This is an online tutorial for the plot_map function in collEcol package by Dan Sankey
If you are interested in making a googlemap style plot or video of your solo or group GPS data, but aren't that familiar with the documentation/help files for the collEcol package, then this tutorial should be for you. Hopefully this tutorial will help solve all your problems, but if not, or you would like me to edit the functions to perform something differently, then don't hesitate to contact me on dwsankey@gmail.com with any questions or suggestions.
if(!require(pacman)) install.packages("pacman") # Functions for loading required libraries library(pacman) p_load(ggmap, ggplot2 , plyr , collEcol)
Using the example data (from a pigeon homing flight)
data("solo") plot_map(data = data , type = "solo" , image.or.vid = "image", zoom = 13)
Plot of a pigeon's flight over Surrey, England
plot_map( data = data[1:60,] , file.to.folder = F, image.or.vid = "video", frame.size = 5)
This (above) is the function you would use to have a look at parameters and see if it really is the video you want, before saving by selecting file.to.folder = T
.
Change the parameters, explore the function with ?plot_map
I save an example to folder in the group video below. Follow that part of the tutorial for extra tips on saving your video.
If you are happy with the parameters you would like for your video then skip straight to section 4. This section is just an example using my (very short) dataset.
It is however, really important to practice with file.to.folder = F
. Firstly, to save yourself time in case you get something wrong, but also because google will only let you take a fixed number of images from their website per day. I believe this maximum is 1000 images.
# load in the data data("dataG") # these data are called dataG lapply(dataG,head,n=5) # First 5 rows
plot_map (data = dataG , type = "group" , image.or.vid = "video", tail.size = 20, frame.size = 5, file.to.folder = F, zoom = 19, n.indiv = 8)
Before you this next chunk it is good to set your working directory to the one to which you would like the images to store.
plot_map(data = dataG, wd = getwd(), plot_name = "my_video" , file.to.folder = T, type = "group" , image.or.vid = "video", tail.size = 20, frame.size = 5, zoom = 19, n.indiv = 8)
Go to your working directory and export the .png files into a movie maker software.
I highly reccommend imagej as it is efficient, free, and doesn't take up a lot of memory.
Happy coding!
:)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.